//一行代码实现一个简单的模板字符串替换
//输入   {{name}}很厉害,才{{age}}岁
//      {name:"二月",age:"15"};
//输出：二月很厉害,才15岁
const template = "{{name}}很厉害,才{{age}}岁";
const context = {name:"二月",age:"15"};
function render(template,context){
    return template.replace(/\{\{(.*?)\}\}/g,(match,key)=> context[key.trim()]);
}

console.log(render(template,context));